package cn.com.headfree.callback.call;

import cn.com.headfree.base.controller.ResultData;
import feign.Response;
import cn.com.headfree.callback.back.FileServerCallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 文件服务
 */
@FeignClient(value = "comm-file-server", fallback = FileServerCallBack.class)
public interface FileServerCall {

    /**
     * 根据系统编码和业务Id以及业务节点值获得该节点下所有的文件列表，如果节点为空，可以不传，获得的是该系统编码下业务ID的所有文件列表
     * @return ResultData
     */
    @RequestMapping("/comm-file-server/file/findFileList")
    @ResponseBody
    public ResultData findFileList(@RequestParam("sysCode") String sysCode,
                                   @RequestParam("businessId") String businessId,
                                   @RequestParam("businessNode") String businessNode);

    /**
     * 文件下载
     * @param fileId
     * @return
     */
//    @RequestMapping(value = "/download",consumes = MediaType.APPLICATION_PROBLEM_JSON_VALUE)
    //@RequestMapping(value = "/download")
    @RequestMapping("/comm-file-server/file/download")
    public Response downloadFile(@RequestParam("fileId") String fileId);

    @RequestMapping("/comm-file-server/file/deleteFile")
    @ResponseBody
	public ResultData deleteFile(@RequestParam("fileId") String fileId);

}
